<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script language=javascript src='https://testsso.boton-tech.com/maccess/js/maccess_login.js'></script>
</head>

<body>
    <div>loading</div>
</body>

</html>
<script>
    alert(1)
    function login(data, redirectUrl) {
        if (redirectUrl && redirectUrl !== '') {
            redirectUrl = '&redirecturl=' + encodeURIComponent(redirectUrl)

        }
        return new Promise((resolve, reject) => {
            oapi_login.login(data, redirectUrl, res => {
                if (res.code == 0 && res.result.access_token) {
                    resolve(res.result.access_token)
                }
                else {
                    reject(res)
                }
            })
        })
    }

    let href = "https://oapi.dingtalk.com/connect/qrcommit?showmenu=false&code=810C0549-51D5-4662-A1AE-C1E91D3AEB5F&appid=dingoaaioigdn8tevlk415&redirect_uri=https%3A%2F%2Ftestsso.boton-tech.com%2Fcas"
    login({ ticket: '' }, href).then(token => {
        //将token存入本地
    }).catch((info) => {
        alert(JSON.stringify(info))
        //
        if (info.code == '401010') {
            //重定向
            window.location.href = info.result.redirecturl
        }
        else if (info.code == '401020') {
            
        }
        else {
            alert('error')
        }

    })
</script>